<?
$bm=$this->url(array('module'=>'default',
                      'controller'=>'request',
                      'action'=>'bookmark',
                      'article'=>$this->index
                      )       
              );
$web=$this->url(array('module'=>'default',
                       'controller'=>'article-gallery',
                       'action'=>'view',
                       'article'=>$this->index,
                       'index'=>$this->id
                      )       
              );
$caption = !$this->marked ? "Add to" : "Remove from";
# echo $this->articleset->media;

?> 

<center>


<? 
  

if ($this->articleset->media):

 for ($x=0;$x<sizeof($this->items);$x++) {
    $item = $this->items[$x]; 

    if (strpos($item->id,$this->id)!==false) {
        break;
    }
 }
  $path = str_replace(DATA_PATH, '', $item->media);  ?> 
<center>
<video width="<?= VIDEO_WIDTH ?>" height="<?= VIDEO_WIDTH * 0.666 ?>" controls="controls" src="http://<?= $_SERVER['SERVER_NAME'] ?>/<?= $path ?>" >
  <source src="http://<?= $_SERVER['SERVER_NAME'] ?>/<?= $path ?>" type="video/mp4">
Your browser does not support the video tag.
</video> 
</center>
 <p class="note">

<img src="/images/clear.gif" onload="DownloadProgressAttach(this)"/>
<a target="_blank" href="<?= $path ?>">Download</a> video.</p>

<? else: ?>

<img src="/images/clear.gif" class="/request/picture/name/<?= $this->group ?>/index/<?= $this->id ?>" 
    onclick="ArticleAdvance(1)"
    onload="attachPicture (this)" id="box"/> 

<? endif ?> 
</center> 


			
<div class="box-white" id="p.dl">
					
<p><label for="drp">Article</label><select id="drp" 

<? if (is_video($this->articleset->type)): 

      $articleURI = $this->url (array('id'=>NULL));
      $jump       = "LoadPageByPattern('%s'+this.value,'p.dl', '%s/id/'+this.value)"; 
      $download   = "/request/sab/groupname/{$this->group}/index/{$this->index}/async/1/id/";
      $href       =  sprintf($jump, $download, $articleURI ); 

?>

onchange="<?= $href ?>"

<? else: ?>

onchange="LoadPicturebyKey(this.options[this.selectedIndex].value)"

<? endif ?> 
>

<? 
for ($x=0;$x<sizeof($this->items);$x++):
      $item       = $this->items[$x];
      $temp       = explode ('-', $item->id);
      $key        = $temp[0]; ?>

<option value="<?= is_video($this->articleset->type) ? $key : $item->id ?>"

<? if (strpos($item->id,$this->id)!==false): ?> 
selected
<? endif ?>

><?= deSubject(html_entity_decode($item->subject)) ?></option>

<? endfor ?></select></p>
				
</div>


<p class="note" id="p.subject">
<?= $this->subject ?>
</p>
 
<p class="note">
<a href="<?= $bm ?>"><?= $caption ?></a> bookmarks.
</p>

<? if (!IPHONE_UI): ?>
<p class="note">
View article on <a href="<?= $web ?>">full site</a>.
</p>
<? endif ?>

   <!-- end visible content -->
 <input value="<?= $this->group ?>" id="gn" type="hidden"/>


<script language="javascript">
    var db=[]
<? for ($x=0;$x<sizeof($this->items);$x++) echo 'db.push("' . $this->items[$x]->subject . '");'; ?>
    $('p.titlebar').invoke = function (sender, e) {
        var d=$('drp'), index = d.selectedIndex,
              text = d.options[index].text;
        this.innerHTML = text;
    }
    $('p.subject').invoke = function (sender, e) {
        var d=$('drp'), index = d.selectedIndex,
              text = db[index];
        this.innerHTML = text;
    }
    ServiceBus.Subscribe ('OnSlideComplete', $('p.titlebar'), $('p.subject'));

</script>



